package com.tiyo.monitor.service.impl;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tiyo.monitor.mapper.SysOperLogMapper;
import com.tiyo.monitor.mapper.domain.SysOperLog;
import com.tiyo.monitor.service.SysOperLogService;
@Service
public class SysOperLogServiceImpl implements SysOperLogService {
	@Autowired
	SysOperLogMapper sysOperLogMapper;
	@Override
	public void insertOperlog(SysOperLog operLog) {
		sysOperLogMapper.insert(operLog);

	}

	@Override
	public IPage<SysOperLog> selectOperLogList(SysOperLog operLog) {
		QueryWrapper<SysOperLog> queryWrapper = new QueryWrapper<SysOperLog>();
		Page<SysOperLog> page = new Page<SysOperLog>(1, 10);
		return sysOperLogMapper.selectPage(page, queryWrapper);
	}

	@Override
	public void deleteOperLogByIds(String ids) {
		
		sysOperLogMapper.deleteBatchIds(Arrays.asList(ids.split(",")));
	}

	@Override
	public SysOperLog selectOperLogById(Long operId) {
		return sysOperLogMapper.selectById(operId);
	}

	@Override
	public void cleanOperLog() {
		Map<String, Object> columnMap = new HashMap<String, Object>();
		sysOperLogMapper.deleteByMap(columnMap);

	}

}
